package com.ebupt.migu.music.autoTri.Enum;

import java.util.Arrays;

/**
 * @author xuhongsong
 * @version 1.0
 * @date 2020/7/28 17:43
 */
public enum RelationEnum {
    SONG(1,2001,"歌曲"),
    ALBUM(2,2003,"专辑"),
    MV(3,2033,"mv素材");
    // 2022 演唱会对象 2019 数字专辑

    private Integer grade;
    private Integer code;
    private String message;

    public Integer getGrade() {
        return grade;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    /**
     * 私有构造,防止被外部调用
     * @param code
     * @param message
     */
     RelationEnum(Integer grade, Integer code, String message){
         this.grade=grade;
         this.code=code;
        this.message=message;
    }

    public static RelationEnum getValueByKey(Integer grade){
        RelationEnum[] relationEnums=RelationEnum.values();
        return  Arrays.stream(relationEnums).filter(relationEnum -> relationEnum.getGrade().equals(grade)).findFirst().orElse(null);
    }

}
